package com.hxkj.controller.wechat.ueditor;

import com.alibaba.fastjson.JSONObject;
import com.integral.mall.file.service.SysFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/***
 *  @author yaosy
 *  @date 2018年6月20日09:43:32
 *  @desc 富文本框文件上传控制层
 * */
@RestController
@RequestMapping("/upload")
public class UploadController{

	private static final long serialVersionUID = 1L;

	@Value("${cms.imgUrl}")
	private String path ;

	@Value("${cms.realPath}")
	private String realPath;


	@Autowired
	private SysFileService sysFileService;

	@RequestMapping(value = "/upload")
	public JSONObject upload(HttpServletRequest request) throws  Exception{
		String back = new ActionEnter( request, realPath+path,sysFileService).exec();
        JSONObject jsonObject =  JSONObject.parseObject(back);
		return jsonObject;
	}


	
}
